package MainLaunch;
import AudioTools.myAudio;
import AudioTools.myAudioPlayerException;
import UI.BarDeProgression;
import UI.Visualisation;
import UI.Window;
import VideoTools.AnalyseListOfCircle;
import VideoTools.BufferAnalyse;
import VideoTools.ThreadVideo;
import VideoTools.VideoPlayer;
import VideoTools.VideoPlayerException;
import VideoTools.AnalyseListOfCircle.AnalyseAlgorythme;


public class Main {

	//	 constant for the JMF tools
	public static final String URL="vfw://0";
	public static final String DRIVER="vfw:Microsoft WDM Image Capture (Win32):0";
	private static Window window;
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		BarDeProgression bp = new BarDeProgression();
		window = new Window();
		process(window);
		setEnabledWindow(false);
	}
	
	public static void process(Window window){
		
		Visualisation visual = new Visualisation(window);
		window.validate();
		window.repaint();
			
		
		VideoPlayer vp=null;
		try {
			vp = new VideoPlayer(DRIVER,URL);
		} catch (VideoPlayerException e) {
			Erreur(e.getMessage());
		}
		//		 instance of the Thread class
		ThreadVideo tv=new ThreadVideo(vp,visual,window);
		// lets go
		try {
			tv.start();
		} catch (VideoPlayerException e) {
			Erreur(e.getMessage());
		}
	}
	

	public static void Erreur(String erreur){
		System.err.println("erreur : " + erreur);
	}
	
	public static void setEnabledWindow(boolean enable){
		window.setEnabled(enable);
		ThreadVideo.initialisation();
	}
}
